package com.itheima09;

import java.util.Collections;
import java.util.HashSet;

/**
 * @author Xiao
 * @date 2021/7/26
 */
public class HashSetDemo01 {
    /**
     * 练习：
     * HashSet集合存储字符串并遍历
     */
    public static void main(String[] args) {
        HashSet<String> hs = new HashSet<>();
        Collections.addAll(hs, "aa", "bb", "cc");
        hs.add("hello");
        hs.add("hello");
        hs.add("world");
        hs.add("Java");
        hs.add("Java");
        System.out.println(hs);
        System.out.println("---------");
        for (String s : hs) {
            System.out.println(s);
        }
    }
}
